import superRequest from '@/utils/http/index'
import { IDataType } from '@/utils/http/types'

/** 获取菜单树(接口) */
export const apiGetMenuTree = async () => {
  return await superRequest.get<IDataType>({
    url: '/menu/tree',
  })
}

/** 菜单列表(接口) */
export const apiMenuList = async (data: any) => {
  return await superRequest.post<IDataType>({
    url: '/menu/list',
    data,
  })
}

/** 菜单新增(接口) */
export const apiMenuAdd = async (data: any) => {
  return await superRequest.post<IDataType>({
    url: '/menu/add',
    data,
  })
}

/** 菜单修改(接口) */
export const apiMenuUpdate = async (data: any) => {
  return await superRequest.post<IDataType>({
    url: '/menu/update',
    data,
  })
}

/** 菜单删除(接口) */
export const apiMenuDelete = async (data: any) => {
  return await superRequest.post<IDataType>({
    url: '/menu/delete',
    data,
  })
}

/** 菜单批量设置角色(接口) */
export const apiMenuSetRole = async (data: any) => {
  return await superRequest.post<IDataType>({
    url: '/menu/setRole',
    data,
  })
}
